##cmake_minimum_required( VERSION 2.8 )
project("ts plugin standart login")
find_package( Qt4 REQUIRED )

ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_DEFINITIONS(-DQT_PLUGIN)
#ADD_DEFINITIONS(-DQT_NO_DEBUG)
ADD_DEFINITIONS(-DQT_SHARED)

include( ${QT_USE_FILE} )
INCLUDE_DIRECTORIES(
    ${QT_INCLUDE_DIR}
    ${QT_QTSQL_INCLUDE_DIR}
    ${CMAKE_CURRENT_BINARY_DIR}
    ../../../core/interfaces
)


set(INSTPREF ${CMAKE_INSTALL_PREFIX})
configure_file(../../../core/src/def.h.in def.h)

set( HEADERS
        tspl_login_std.h
        maindialog.h
	)
set( SOURCES 
        tspl_login_std.cpp
        maindialog.cpp
	)
set( UIS
    maindialog.ui
)

qt4_wrap_ui(UIS_H ${UIS})

qt4_wrap_cpp(MOC ${HEADERS})

set( RESOURCES resources.qrc )
qt4_add_resources( QRC_SOURCES ${RESOURCES} )

add_library(login_std SHARED ${SOURCES} ${MOC} ${UIS_H} ${QRC_SOURCES})

target_link_libraries(login_std ${QT_LIBRARIES} ${QT_QTSQL_LIBRARIES})

# install for linux
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
	set(tsdir ${CMAKE_INSTALL_PREFIX})
        set(tsdir_pl ${tsdir}/lib/torisakura)
        install(TARGETS login_std DESTINATION ${tsdir_pl})
endif()
